package in.muton.edushare.pages.user;

import in.muton.edushare.panels.assignment.AssignmentListPanel;
import in.muton.edushare.poll.panels.PollList;
import in.muton.edushare.poll.panels.UserPollPanel;

import org.apache.wicket.PageParameters;
import org.apache.wicket.markup.html.CSSPackageResource;

import com.edushare.common.constants.ApplicationConstants;
import com.edushare.common.exceptions.EduShareRuntimeException;

public class UserPolls extends UserBase {

	public UserPolls(PageParameters params) {
		super(params);
		if(getLoggedInUser() != getModel().getObject())
			throw new EduShareRuntimeException("Unauthorised access of poll page.");		
		add(CSSPackageResource
				.getHeaderContribution(PollList.class, "Poll.css"));
		add(CSSPackageResource.getHeaderContribution(AssignmentListPanel.class,
			"assignment.css"));
		add(new UserPollPanel("activePanel", getModel()));
	}

	@Override
	public String getActivePage() {
		return "UserPolls";
	}

	@Override
	public String getPageTitle() {
		return getModel().getObject().getCompleteUserName() + " | Polls | "
				+ ApplicationConstants.APPLICATION_NAME;
	}

	@Override
	public String getUserRole() {
		return " : Polls";
	}
}
